<script setup>
// import { ref, toRefs, nextTick } from 'vue';
import { useVModel } from '@vueuse/core';
defineOptions({
  name: 'TyPlmCheckbox'
});

const props = defineProps({
  modelValue: {
    type: [String, Boolean, Number]
  },
  label: {
    type: String
  },
  // true-value为elementplus2.6版本 可能存在兼容问题暂时不用
  valueMap: {
    type: Object,
    default: () => {
      return {
        true: true,
        false: false
      };
    }
  }
});
const attrs = useAttrs()   // 现在 attrs.disabled 就能用了
console.log("替换单选框",attrs);
const emit = defineEmits(['update:modelValue']);
const value = useVModel(props, 'modelValue', emit);
const isFirst = ref(true)
watch(value, () => { isFirst.value = false }, { once: true })
if (isFirst.value && value.value !== props.valueMap.true) {
  value.value = props.valueMap.true
}
</script>

<template>
  <el-checkbox v-model="value" v-bind="$attrs.options || $attrs" class="ty-base-checkbox" :disabled="$attrs.options.label == '同时导入团队和资源'">
    <slot>{{ $attrs.options ? $attrs.options.label : label }}</slot>
  </el-checkbox>
</template>

// <style lang="scss" scoped>
// @import '@/ty-ui/styles/lib/ty-base-checkbox.scss';

// </style>
